package com.pow.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.pow.entity.Role;

public interface RoleRepository extends JpaRepository<Role, String>,JpaSpecificationExecutor<Role>{

	/**
	 * 通过id查询该用户不含有的角色信息
	 * @param id
	 * @return 返回角色role集合
	 */
	@Query(value=" select * from roles where id not IN(select r.id from users u , roles r,user_role_tb ur where u.id=ur.user_role_tb_user_id and r.id=user_role_tb_role_id and u.id=?1" + 
			") ",nativeQuery=true)
	List<Role> getNotRoleById(String id);
}
